#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
void hjx1()
{
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(2);
    v1.push_back(3);
    v1.push_back(4);
    v1.push_back(5);
    v1.push_back(6);
    for(auto e:v1)
    {
        cout<<e;
    }
    cout<<endl;
    vector<int> v2(v1);
    for(auto e:v2)
    {
        cout<<e;
    }
    cout<<endl;
}
void hjx2()
{
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(2);
    v1.push_back(3);
    v1.push_back(4);
    v1.push_back(5);
    v1.push_back(6);
    //迭代器遍历
    vector<int>::iterator it=v1.begin();
    while(it!=v1.end())//可读可写
    {
        (*it)+=1;
        cout<<*it;
        it++;
    }
    cout<<endl;
//    for(size_t i=0;i<v1.size();i++)
//    {
//        cout<<v1[i];
//    }
    vector<int>::const_iterator it1=v1.begin();
    while(it1!=v1.end())
    {
//        *it1+=1;//只读const迭代器bug
        cout<<*it1;
        it1++;
    }
    cout<<endl;
    //逆置
    vector<int>::reverse_iterator it2=v1.rbegin();
    while(it2!=v1.rend())
    {
        *it2-=1;
        cout<<*it2;
        it2++;
    }
    cout<<endl;
    vector<int>::const_reverse_iterator it3=v1.rbegin();
    while(it3!=v1.rend())
    {
        //*it3-=1;//只读const迭代器bug
        cout<<*it3;
        it3++;
    }
    cout<<endl;
    cout<<v1.capacity()<<endl;
    cout<<v1.size()<<endl;
}
void hjx3()
{
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(2);
    v1.push_back(3);
    v1.push_back(4);
    v1.push_back(5);
    v1.push_back(6);
    v1.insert(v1.begin(),0);
    for(auto e:v1)
    {
        cout<<e;
    }
    cout<<endl;
    v1.erase(v1.begin());
     for(auto e:v1)
    {
        cout<<e;
    }
    cout<<endl;
    vector<int>::iterator pos=find(v1.begin(),v1.end(),3);
    if(pos!=v1.end())//表示找到了
    {
         v1.erase(pos);
    }
    for(auto e:v1)
    {
        cout<<e;
    }

}
void hjx4()
{
    vector<int> v1;
    v1.push_back(2);
    v1.push_back(10);
    v1.push_back(9);
    v1.push_back(67);
    v1.push_back(23);
    sort(v1.begin(),v1.end());
    for(auto e:v1)
    {
        cout<<e<<" ";
    }
}
int main()
{
//    hjx1();
//    hjx2();//迭代器遍历
//      hjx3();//insert
     hjx4();//排序
    return 0;
}























